import 'package:flutter/material.dart';
import 'package:flutter_swiper_view/flutter_swiper_view.dart';

const List<String> defautImages = [
  'https://img.shetu66.com/2023/03/10/1678416892458199.jpg',
  'https://img.shetu66.com/2023/07/04/1688452147066774.png',
  'https://bpic.588ku.com/element_origin_min_pic/23/07/11/d32dabe266d10da8b21bd640a2e9b611.jpg!r650',
];

class CommonSwiper extends StatefulWidget {
  final List<String> images;
  const CommonSwiper({super.key, this.images = defautImages});

  @override
  State<CommonSwiper> createState() => _CommonSwiperState();
}

class _CommonSwiperState extends State<CommonSwiper> {
  @override
  Widget build(BuildContext context) {
    var height = MediaQuery.of(context).size.width / 1024 * 683;
    return SizedBox(
      height: height,
      child: Swiper(
        itemBuilder: (BuildContext context, int index) {
          return Image.network(widget.images[index], fit: BoxFit.fill);
        },
        autoplay: true,
        itemCount: widget.images.length,
        pagination: SwiperPagination(),
        // control: new SwiperControl(),
      ),
    );
  }
}
